﻿<template>
    <el-dialog :close-on-press-escape="false" :append-to-body="true" :visible="show" @opened="opened" @closed="closed" @close="show=false" :close-on-click-modal="false">
        <el-form ref="disPartner" label-position="right" label-width="120px" :model="disPartner" :rules="rules">
            <input type="hidden" :model="disPartner.id" />
                                    <el-form-item label="地址" prop="address">
                                <el-input v-model="disPartner.address" placeholder="地址" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="" prop="admindomain">
                                <el-input v-model="disPartner.admindomain" placeholder="" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="" prop="auditamount">
                                <el-input v-model="disPartner.auditamount" placeholder="" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="" prop="balance">
                                <el-input v-model="disPartner.balance" placeholder="" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="" prop="balanceamount">
                                <el-input v-model="disPartner.balanceamount" placeholder="" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="编码" prop="code">
                                <el-input v-model="disPartner.code" placeholder="编码" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="联系人" prop="contact">
                                <el-input v-model="disPartner.contact" placeholder="联系人" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="创建人" prop="creater">
                                <el-input v-model="disPartner.creater" placeholder="创建人" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="创建人" prop="createrid">
                                <el-input v-model="disPartner.createrid" placeholder="创建人" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="创建时间" prop="createtime">
                                <el-date-picker type="date" @change="cbtime" v-model="disPartner.createtime" placeholder="创建时间" style="width: 240px"></el-date-picker>
                            </el-form-item>
                                                <el-form-item label="" prop="currency">
                                <el-input v-model="disPartner.currency" placeholder="" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="" prop="currencyid">
                                <el-input v-model="disPartner.currencyid" placeholder="" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="" prop="debt">
                                <el-input v-model="disPartner.debt" placeholder="" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="" prop="debtamount">
                                <el-input v-model="disPartner.debtamount" placeholder="" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="" prop="dispricemargin">
                                <el-input v-model="disPartner.dispricemargin" placeholder="" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="" prop="dispricetype">
                                <el-input v-model="disPartner.dispricetype" placeholder="" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="域名" prop="domain">
                                <el-input v-model="disPartner.domain" placeholder="域名" style="width: 240px" />
                            </el-form-item>
                                                                        <el-form-item label="名称" prop="name">
                                <el-input v-model="disPartner.name" placeholder="名称" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="" prop="parent">
                                <el-input v-model="disPartner.parent" placeholder="" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="" prop="parentid">
                                <el-input v-model="disPartner.parentid" placeholder="" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="" prop="pendingamount">
                                <el-input v-model="disPartner.pendingamount" placeholder="" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="电话" prop="phone">
                                <el-input v-model="disPartner.phone" placeholder="电话" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="" prop="quota">
                                <el-input v-model="disPartner.quota" placeholder="" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="" prop="quotaamount">
                                <el-input v-model="disPartner.quotaamount" placeholder="" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="备注" prop="remark">
                                <el-input v-model="disPartner.remark" placeholder="备注" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="角色" prop="role">
                                <el-input v-model="disPartner.role" placeholder="角色" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="" prop="salepricemargin">
                                <el-input v-model="disPartner.salepricemargin" placeholder="" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="" prop="salepricetype">
                                <el-input v-model="disPartner.salepricetype" placeholder="" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="" prop="shippingamount">
                                <el-input v-model="disPartner.shippingamount" placeholder="" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="状态" prop="status">
                                <el-input v-model="disPartner.status" placeholder="状态" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="" prop="transferamount">
                                <el-input v-model="disPartner.transferamount" placeholder="" style="width: 240px" />
                            </el-form-item>
                                </el-form>
        <div slot="footer">
            <el-button @click="cancel">取消</el-button>
            <el-button type="primary" :loading="modalLoading" @click="ok">确定</el-button>
        </div>
    </el-dialog>
</template>
<script>
export default {
    name: 'DisPartner',
    data() {
        return {

            show: false,
            modalLoading: false,
            disPartnerId: "",
            disPartner: {

            },
            rules: {

            }
        };
    },
    mounted: function() {


    },
    methods: {
        cbtime: function(value) {
            this.others;
        },
        opened() {

            this.getDetail();

        },
        closed() {
            this.disPartner = {

            }
        },
        showDialog(id) {
            this.disPartnerId = id;
            this.show = true;
        },
        getDetail: function() {
            if (this.disPartnerId == null || this.disPartnerId == undefined || this.disPartnerId == "") return;
            var me = this;
            me.showLoading();
            me.$http.post("/sys/dispartner/show_" + me.disPartnerId + ".do").then(response => {
                var body = response;
                if (body.status == 0) {
                    me.disPartner= body.obj;

                }
                me.hideLoading();
            }, response => {
                me.hideLoading();
            });
        },
        ok: function() {
            var ok = false;
            this.$refs['disPartner'].validate((valid) => {
                ok = valid;
                if (valid) {

                } else {
                    this.errorMessage('请认真填写数据');
                }
            })
            if (!ok) return;
            var me = this;

            me.modalLoading = true;
            me.$http.post("/sys/dispartner/doSave.action", me.disPartner).then(response => {
                var body = response;
                if (body.status == 0) {
                    me.successMessage("保存成功！");
                    me.show = false;
                    me.$emit("ok");

                } else {
                    me.errorMessage(body.info);
                }
                me.modalLoading = false;
            }, response => {
                me.modalLoading = false;
            });
        },
        cancel: function() {
            this.disPartner= {};
            this.show = false;
            this.$emit("cancel");
        }
    }
}
</script>
<style scoped>
</style>